<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>押品搜索</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>押品搜索</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                押品搜索
            </h2>
        </div>
    </div>
</div>
<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="searchEstate" class="form-horizontal" role="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group" id="bug1">
        %{--第一行--}%
            <div class="row">
                <div class="form-group col-sm-3">
                    <label for="district" class="col-sm-3 control-label">城市</label>
                    <div class="col-sm-9">
                        <g:select class="form-control" name="city" id="city"
                                  from="${com.cindata.City.executeQuery("select distinct e.city as city from  Estate e ")}"
                                  valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                  value="${params?.city}"
                                  noSelection="${["-1": '杭州市']}"/>
                    </div>
                </div>
                <div class="input-group col-sm-8">
                    <input type="text" class="form-control" id="searchLoad"/>
                    <span class="pe-7s-search fa-2x form-control-feedback"></span>
                    <ul id="searchList" style="position: relative"></ul>
                </div>
            </div>
            <div id="gradeContent">

            </div>
            </div>
        </g:form>
    </div>
    </div>
</div>
<asset:javascript src="echarts/echarts-all-3.js" />
<asset:javascript src="main/grade.js" />
<g:javascript>
    // $('#searchList input').click(function () {
    //    var communityId= $(this).val()
    //    var city= $('#city').val()
    //     $('#gradeContent').load("/estate/gradeContent?city="+city+"&communityId="+communityId);
    // })

    $(function () {

        $("#resetBtn").click(function () {
            $("#fullName").val("");
        })
//searchLoad 模糊查询
        searchLoad.onkeyup=function(){
            var inputLoad=this.value;
            if(!inputLoad){
                return;
            }
            $.ajax({
                url:'/estate/searchCommunity',
                data:{'communityName':inputLoad},
                success:function(data){
                    var html='',
                            obj=data.list;
                    console.log(obj)
                    var href=obj.communityId
                    $.each(obj,function(i,obj){
                        html+="<li><a href = '"+href+"'>"+obj.name+"<a/><li/>"
                    });
                    $('#searchList').html(html);
                }
            })
        }


    });
    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_city span:first").html("请选择城市");
        $("#city").val("");
        $("#s2id_district span:first").html("请选择行政区");
        $("#district").val("");
    })
</g:javascript>

</body>
</html>
